<?php


namespace app\lunwen\controller;


use app\lunwen\model\TeacherUploadFileModel;
use cmf\controller\HomeBaseController;

class TeacherApplyBestController extends HomeBaseController
{
    public function index(){

        $file = new TeacherUploadFileModel();
        $data = $file
            ->whereTime('create_time','>',session('beforeYear'))
            ->whereTime('create_time','<',session('afterYear'))
            ->all();
        $this->assign('title',$data);
        return $this->fetch(':teacherApplyBest');

    }

    //删除文件
    public function delete(){
        //echo $_GET["stu_id"];
        //echo $_GET["file_name"];
        //删除文件
        echo $filename = "D:\phpstudy_pro\\thinkcmf\ThinkCMF\public\static\\file\\{$_GET["file_name"]}";
        unlink($filename);

        $del = new TeacherUploadFileModel();
        $del->where('stu_id',$_GET["stu_id"])
            ->where('file_name',$_GET["file_name"])
            ->delete();

        $file = new TeacherUploadFileModel();
        $data = $file
            ->whereTime('create_time','>',session('beforeYear'))
            ->whereTime('create_time','<',session('afterYear'))
            ->all();
        $this->assign('title',$data);
        return $this->fetch(':teacherApplyBest');
    }

}